package com.atguigu.spzx.manage.service.Impl;


import com.atguigu.spzx.manage.mapper.FeedbackMapper;
import com.atguigu.spzx.manage.service.FeedbackService;
import com.atguigu.spzx.model.dto.system.FeedbackDto;
import com.atguigu.spzx.model.entity.system.Feedback;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class FeedbackServiceImpl implements FeedbackService {



    @Autowired
    private FeedbackMapper feedbackMapper ;


    @Override
    public PageInfo<Feedback> findByPage(FeedbackDto feedbackDto, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum , pageSize);
        List<Feedback> sysUserList = feedbackMapper.findByPage(feedbackDto) ;
        PageInfo pageInfo = new PageInfo(sysUserList) ;
        return pageInfo;
    }

    @Override
    public void markPopularById(Long id) {

        feedbackMapper.updateMarkById(id);
    }

    @Override
    public void closePopularById(Long id) {
        feedbackMapper.updateCloseById(id);
    }

    @Override
    public void deleteById(Long id) {
        feedbackMapper.deleteById(id);
    }

}
